Computer-readable medium having image decoding program stored thereon

ABSTRACT

A computer-readable medium having stored thereon an image decoding program which, when executed by a computer, performs the steps of storing a reference image which is a previously decoded image, receiving information including motion vector information and rounding method information specifying a rounding method used in synthesizing a prediction image, and synthesizing a prediction image by performing motion compensation using the motion vector information and the reference image. The step of synthesizing a prediction image includes the step of performing either a positive rounding method or a negative rounding method for interpolating intensity values of pixels in performing the motion compensation according to the rounding method information, but enables performance of both the positive rounding method and the negative rounding method for interpolating intensity values of pixels in performing the motion compensation. The rounding method information specifies either the positive rounding method or the negative rounding method.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The present invention relates to an image sequence coding anddecoding method which performs interframe prediction using quantizedvalues for chrominance or luminance intensity.

[0003] 2. Description of Related Art

[0004] In high efficiency coding of image sequences, interframeprediction (motion compensation) by utilizing the similarity of adjacentframes over time, is known to be a highly effective technique for datacompression. Today's most frequently used motion compensation method isblock matching with half pixel accuracy, which is used in internationalstandards H.263, MPEG1, and MPEG2. In this method, the image to be codedis segmented into blocks and the horizontal and vertical components ofthe motion vectors of these blocks are estimated as integral multiplesof half the distance between adjacent pixels. This process is describedusing the following equation:

[0005] [Equation 1] $\begin{matrix}{{P\left( {x,y} \right)} = {R\left( {{x + u_{i}},{{y + {v_{i}\quad \left( {x,y} \right)}} \in B_{i}},{0 \leq i < N}} \right.}} & (1)\end{matrix}$

[0006] where P(x, y) andR(x, y) denote the sample values (luminance orchrominance intensity) of pixels located at coordinates (x, y) in thepredicted image P of the current frame and the reference image (decodedimage of a frame which has been encoded before the current frame) R,respectively. x and y are integers, and it is assumed that all thepixels are located at points where the coordinate values are integers.Additionally it is assumed that the sample values of the pixels arequantized to non-negative integers. N, Bi, and (ui, vi) denote thenumber of blocks in the image, the set of pixels included in the i-thblock of the image, and the motion vectors of the ith block,respectively.

[0007] When the values for ui and vi are not integers, it is necessaryto find the intensity value at the point where no pixels actually existin the reference image. Currently, bilinear interpolation using theadjacent four pixels is the most frequently used method for thisprocess. This interpolation method is described using the followingequation:

[0008] [Equation 2] $\begin{matrix}{R\left( {{x + \frac{p}{d}},{{y + \frac{q}{d}} = \left( {{{\left( {d - q} \right)\left( {{\left( {d - p} \right){R\left( {x,y} \right)}} + {{pR}\left( {{x + 1},y} \right)}} \right)} + {q\left( {{\left( {d - p} \right){R\left( {x,{y + 1}} \right)}} + {{pR}\left( {{x + 1},{y + 1}} \right)}} \right)}}//d^{2}} \right.}} \right.} & (2)\end{matrix}$

[0009] where d is a positive integer, and p and q are smaller than d butnot smaller than 0. “//” denotes integer division which rounds theresult of normal division (division using real numbers) to the nearestinteger.

[0010] An example of the structure of an H.263 video encoder is shown inFIG. 1. As the coding algorithm, H.263 adopts a hybrid coding method(adaptive interframe/intraframe coding method) which is a combination ofblock matching and DCT (discrete cosine transform). A subtractor 102calculates the difference between the input image (current frame baseimage) 101 and the output image 113 (related later) of theinterframe/intraframe coding selector 119, and then outputs an errorimage 103. This error image is quantized in a quantizer 105 after beingconverted into DCT coefficients in a DCT converter 104 and then formsquantized DCT coefficients 106. These quantized DCT coefficients aretransmitted through the communication channel while at the same timeused to synthesize the interframe predicted image in the encoder. Theprocedure for synthesizing the predicted image is explained next. Theabove mentioned quantized DCT coefficients 106 forms the reconstructederror image 110 (same as the reconstructed error image on the receiveside) after passing through a dequantizer 108 and inverse DCT converter109. This reconstructed error image and the output image 113 of theinterframe /intraframe coding selector 119 is added at the adder 111 andthe decoded image 112 of the current frame (same image as the decodedimage of current frame reconstructed on the receiver side) is obtained.This image is stored in a frame memory 114 and delayed for a time equalto the frame interval. Accordingly, at the current point, the framememory 114 outputs the decoded image 115 of the previous frame. Thisdecoded image of the previous frame and the original image 101 of thecurrent frame are input to the block matching section 116 and blockmatching is performed between these images. In the block matchingprocess, the original image of the current frame is segmented intomultiple blocks, and the predicted image 117 of the current frame issynthesized by extracting the section most resembling these blocks fromthe decoded image of the previous frame. In this process, it isnecessary to estimate the motion between the prior frame and the currentframe for each block. The motion vector for each block estimated in themotion estimation process is transmitted to the receiver side as motionvector data 120. On the receiver side, the same prediction image as onthe transmitter side is synthesized using the motion vector informationand the decoding image of the previous frame. The prediction image 117is input along with a “0” signal 118 to the interframe/intraframe codingselector 119. This switch 119 selects interframe coding or intraframecoding by selecting either of these inputs. Interframe coding isperformed when the prediction image 117 is selected (this case is shownin FIG. 2). On the other hand when the “0” signal is selected,intraframe coding is performed since the input image itself isconverted, to a DCT coefficients and output to the communicationchannel. In order for the receiver side to correctly reconstruct thecoded image, the reciever must be informed whether intraframe coding orinterframe coding was performed on the transmitter side. Consequently,an identifier flag 121 is output to the communication circuit. Finally,an H.263 coded bitstream 123 is acquired by multiplexing the quantizedDCT coefficients, motion vectors, the and interframe/intraframeidentifier flag information in a multiplexer 122.

[0011] The structure of a decoder 200 for receiving the coded bit streamoutput from the encoder of FIG. 1 is shown in FIG. 2. The H.263 codedbit stream 217 that is received is demultiplexed into quantized DCTcoefficients 201, motion vector data 202, and a interframe/intraframeidentifier flag 203 in the demultiplexer 216. The quantized DCTcoefficients 201 become a decoded error image 206 after being processedby an inverse quantizer 204 and inverse DCT converter 205. This decodederror image is added to the output image 215 of the interframe/intraframe coding selector 214 in an adder 207 and the sum of theseimages is output as the decoded image 208. The output of theinterframe/intraframe coding selector is switched according to theinterframe/intraframe identifier flag 203. A prediction image 212utilized when performing interframe encoding is synthesized in theprediction image synthesizer 211. In this synthesizer, the position ofthe blocks in the decoded image 210 of the prior frame stored in framememory 209 is shifted according to the motion vector data 202. On theother hand, for intraframe coding, the interframe/intraframe codingselector outputs the “0” signal 213 as is.

SUMMARY OF THE INVENTION

[0012] The image encoded by H.263 is comprised of a luminance plane (Yplane) containing luminance information, and two chrominance planes (Uplane and V plane) containing chrominance information. At this time,characteristically, when the image has 2m pixels in the horizontaldirection and 2n pixels in the vertical direction (m and n are positiveintegers), the Y plane has 2m pixels horizontally and 2n pixelsvertically, the U and V planes have m pixels horizontally and n pixelsvertically. The low resolution on the chrominance plane is due to thefact that the human visual system has a comparatively dull visualfaculty with respect to spatial variations in chrominance. Having suchimage as an input, H. 263 performs coding and decoding in block unitsreferred to as macroblocks. The structure of a macroblock is shown inFIG. 3 The macroblock is comprised of three blocks; a Y block, U blockand V block. The size of the Y block 301 containing the luminanceinformation is 16×16 pixels, and the size of the U block 302 and V block303 containing the chrominance information is 8×8 pixels.

[0013] In H. 263, half pixel accuracy block matching is applied to eachblock. Accordingly, when the estimated motion vector is defined as (u,v), u and v are both integral multiples of half the distance betweenpixels. In other words, {fraction (1/2)} is used as the minimum unit.The configuration of the interpolation method used for the intensityvalues (hereafter the intensity values for “luminance” and “chrominance”are called by the general term “intensity value”) is shown in FIG. 4.When performing the interpolation described in equation 2, the quotientsof division are rounded off to the nearest integer, and further, whenthe quotient has a half integer value (i.e. 0.5 added to an integer),rounding off is performed to the next integer in the direction away fromzero. In other words, in FIG. 4, when the intensity values for 401, 402,403, 404 are respectively La, Lb, Lc, and Ld (La, Lb, Lc, and Ld arenon-negative integers), the interpolated intensity values Ia, Ib, Ic,and Id (Ia, Ib, Ic, and Id are non-negative integers) at positions405,406, 407, 408 are expressed by the following equation:

[0014] [Equation 3]

Ia=La Ib=[(La+Lb+1)/2]Ic=[(L+Lc+1)/2]  (3)

Id=[(La+Lb+Lc+Ld+2)/4]

[0015] where “[ ]” denotes truncation to the nearest integer towards 0(i.e. the fractional part is discarded). The expectation of the errorscaused by this rounding to integers is estimated as follows: It isassumed that the probability that the intensity value at positions 405,406, 407, and 408 of FIG. 4 is used is all 25 percent. When finding theintensity value Ia for position 405, the rounding error will clearly bezero. Also, when finding the intensity value Ib for position 406, theerror will be zero when La+Lb is an even number, and when an odd numberthe error is ½. If the probability that La+Lb will be an even number andan odd number is both 50 percent, then the expectation for the errorwill be 0×½+½×½=¼. Further, when finding the intensity value Ic forposition 407, the expectation for the error is ¼ as for Ib. When findingthe intensity value Id for position 408, the error when the residual ofLa+Lb+Lc+Ld divided by four are 0, 1, 2, and 3 are respectively 0, −¼,½, and ¼. If we assume that the probability that the residual is 0, 1,2, and 3 is all equal (i.e. 25 percent), the expectation for the erroris 0×¼−¼×¼+½×¼+¼×¼=⅛. As described above, assuming that the possibilitythat the intensity value at positions 405-408 being used are all equal,the final expectation for the error is 0×¼+¼×¼+¼×¼+⅛×¼={fraction(5/32)}. This indicates that each time motion compensation is performedby means of block matching, an error of {fraction (5/32)} occurs in thepixel intensity value. Generally in low rate coding, sufficient numberof bits cannot be used for the encoding of the interframe errordifference so that the quantized step size of the DCT coefficient isprone to be large. Accordingly, errors occurring due to motioncompensation are corrected only when it is very large. When interframeencoding is performed continuously without performing intraframe codingunder such environment, the errors tend to accumulate and cause badeffects on the reconstructed image.

[0016] Just as explained above, the number of pixels is about half inboth the vertical and horizontal direction on the chrominance plane.Therefore, for the motion vectors of the U block and V block, half thevalue of the motion vector for the Y block is used for the vertical andhorizontal components. Since the horizontal and vertical components ofthe motion vector for the Y block motion vector are integral multiplesof ½, the motion vector components for the U and V blocks will appear asintegral multiples of ¼ (quarter pixel accuracy) if ordinary division isimplemented. However, due to the high computational complexity of theintensity interpolation process for motion vectors with quarter pixelaccuracy, the motion vectors for U and V blocks are rounded to halfpixel accuracy in H.263. The rounding method utilized in H.263 is asfollows: According to the definition described above, (u, v) denotesthemotion vector of the macroblock (which is equal to the motion vectorfor the Y block). Assuming that r is an integer and s is an non-negativeinteger smaller than 4, u/2 can be rewritten as u/2=r+s/4. When s is 0or 2, no rounding is required since u/2 is already an integral multipleof 1/2. However when s is equal to 1 or 3, the value of s is rounded to2. By increasing the possibility that s takes the value of 2 using thisrounding method, the filtering effect of motion compensation can beemphasized. When the probability that the value of s prior to roundingis 0, 1, 2, and 3 are all 25 percent, the probability that s will be 0or 2 after rounding will respectively be 25 percent and 75 percent. Theabove explained process related to the horizontal component u of themotion vector is also applied to the vertical component v. Accordingly,in the U block and V block, the probability for using the intensityvalue of the 401 position is ¼×¼={fraction (1/16)}, and the probabilityfor using the intensity value of the 402 and 403 positions is both¼×¾={fraction (3/16)}, while the probability for using the intensityvalue of position 404 is ¾×¾={fraction (9/16)}. By utilizing the samemethod as above, the expectation for the error of the intensity value is0×{fraction (1/16)}+¼×{fraction (3/16)}+¼×{fraction (3/16)}+⅛×{fraction(9/16)}={fraction (21/128)}. Just as explained above for the Y block,when interframe encoding is continuously performed, the problem ofaccumulated errors occurs.

[0017] As related above, for image sequence coding and decoding methodsin which interframe prediction is performed and luminance or chrominanceintensity is quantized, the problem of accumulated rounding errorsoccurs. This rounding error is generated when the luminance orchrominance intensity value is quantized during the generation of theinterframe prediction image.

[0018] In view of the above problems, it is therefore an object of thisinvention, to improve the quality of the reconstructed image bypreventing error accumulation.

[0019] In order to achieve the above object, the accumulation of errorsis prevented by limiting the occurrence of errors or performing anoperation to cancel out errors that have occurred.

BRIEF DESCRIPTION OF THE DRAWINGS

[0020]FIG. 1 is a block diagram showing the layout of the H.263 imageencoder.

[0021]FIG. 2 is a block diagram showing the layout of the H.263 imagedecoder.

[0022]FIG. 3 is a drawing showing the structure of the macro block.

[0023]FIG. 4 is a drawing showing the interpolation process of intensityvalues for block matching with half pixel accuracy.

[0024]FIG. 5 is a drawing showing a coded image sequence.

[0025]FIG. 6 is a block diagram showing a software image encodingdevice.

[0026]FIG. 7 is a block diagram showing a software image decodingdevice.

[0027]FIG. 8 is a flow chart showing an example of processing in thesoftware image encoding device.

[0028]FIG. 9 is a flow chart showing an example of the coding modedecision processing for the software image encoding device.

[0029]FIG. 10 is a flow chart showing an example of motion estimationand motion compensation processing in the software image encodingdevice.

[0030]FIG. 11 is a flow chart showing the processing in the softwareimage decoding device.

[0031]FIG. 12 is a flow chart showing an example of motion compensationprocessing in the software image decoding device.

[0032]FIG. 13 is a drawing showing an example of a storage media onwhich an encoded bit stream generated by an encoding method that outputsbit streams including I, P+and P− frames is recorded.

[0033]FIG. 14 is a set of drawings showing specific examples of devicesusing an encoding method where P+and P− frames coexist.

[0034]FIG. 15 is a drawing showing an example of a storage media onwhich an encoded bit stream generated by an encoding method the outputsbit streams including I, B, P+, and P− frames is recorded.

[0035]FIG. 16 is a block diagram showing an example of a block matchingunit included in a device using an encoding method where P+and P− framescoexist.

[0036]FIG. 17 is a block diagram showing the prediction imagesynthesizer included in a device for decoding bit streams encoded by anencoding method where P+and P− frames coexist.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0037] First, in which circumstances the accumulated rounding errors asrelated in the “Prior art” occur must be considered. An example of animage sequences encoded by coding methods which can perform bothunidirectional prediction and bidirectional prediction such as in MPEG.1, MPEG. 2 and H. 263 is shown in FIG. 5. An image 501 is a frame codedby means of intraframe coding and is referred to as an I frame. Incontrast, images 503, 505, 507, 509 are called P frames and are coded byunidirectional interframe coding by using the previous I or P frame asthe reference image. Accordingly, when for instance encoding image 505,image 503 is used as the reference image and interframe prediction isperformed. Images 502, 504, 506 and 508 are called B frames andbidirectional interframe prediction is performed utilizing the previousand subsequent I or P frame. The B frame is characterized by not beingused as a reference image when interframe prediction is performed. Sincemotion compensation is not performed in I frames, the rounding errorcaused by motion compensation will not occur. In contrast, not only ismotion compensation performed in the P frames but the P frame is alsoused as a reference image by other P or B frames so that it may be acause leading to accumulated rounding errors. In the B frames on theother hand, motion compensation is performed so that the effect ofaccumulated rounding errors appears in the reconstructed image. However,due to the fact that B frames are not used as reference images, B framescannot be a source of accumulated rounding errors. Thus, if accumulatedrounding errors can be prevented in the P frame, then the bad effects ofrounding errors can be alleviated in the overall image sequence. InH.263 a frame for coding a P frame and a B frame exists and is called aPB frame (For instance, frames 503 and 504 can both be encoded as a PBframe.) If the combined two frames are viewed as separate frames, thenthe same principle as above can be applied. In other words, ifcountermeasures are taken versus rounding errors for the P frame partwithin a PB frame, then the accumulation of errors can be prevented.

[0038] Rounding errors occur during interpolation of intensity valueswhen a value obtained from normal division (division whose operationresult is a real number) is a half integer (0.5 added to an integer) andthis result is then rounded up to the next integer in the direction awayfrom zero. For instance, when dividing by 4 to find an interpolatedintensity value is performed, the rounding errors for the cases when theresidual is 1 and 3 have equal absolute values but different signs.Consequently, the rounding errors caused by these two cases are canceledwhen the expectation for the rounding errors is calculated (in moregeneral words, when dividing by a positive integer d′ is performed, therounding errors caused by the cases when the residual is t and d′ -t arecancelled). However, when the residual is 2, in other words when theresult of normal division is a half integer, the rounding error cannotbe canceled and leads to accumulated errors. To solve this problem, amethod that allows the usage of two rounding methods can be used. Thetwo rounding methods used here are: a rounding method that rounds halfintegers away from 0; and a rounding method that rounds half integerstowards 0. By combining the usage of these two rounding methods, therounding errors can be canceled. Hereafter, the rounding method thatrounds the result of normal division to the nearest integer and roundshalf integer values away from 0 is called “positive rounding”.Additionally, the rounding method that rounds the result of normaldivision to the nearest integer and rounds half integer values towards 0is called “negative rounding”. The process of positive rounding used inblock matching with half pixel accuracy is shown in Equation 3. Whennegative rounding is used instead, this equation can be rewritten asshown below.

[0039] [Equation 4]

Ia=La Ib=[(La+Lb)/2]Ic=[(La+Lc) /2]  (4)

Id=[(La+Lb+Lc+Ld+1)/4]

[0040] Hereafter motion compensation methods that performs positive andnegative rounding for the synthesis of interframe prediction images arecalled “motion compensation using positive rounding” and “motioncompensation using negative rounding”, respectively. Furthermore, f or Pframes which use block matching with half pixel accuracy for motioncompensation, a frame that uses positive rounding is called a “P+ frame”and a frame that uses negative rounding is called a “P− frame” (underthis definition, the P frames in H. 2.63 are all P+ frames). Theexpectation for the rounding errors in P+ and P− frames have equalabsolute values but different signs. Accordingly, the accumulation ofrounding errors can be prevented when P+ frames and P− frames arealternately located along the time axis. In the example in FIG. 5, ifthe frames 503 and 507 are set as P+ frames and the frames 505 and 509are set as P− frames, then this method can be implemented. The alternateoccurrence of P+ frames and P− frames leads to the usage of a P+frameand a P− frame in the bidirectional prediction for B frames. Generally,the average of the forward prediction image (i.e. the prediction imagesynthesized by using frame 503 when frame 504 in FIG. 5 is beingencoded) and the backward prediction image (i.e. the prediction imagesynthesized by using frame 505 when frame 504 in FIG. 5 is beingencoded) is frequently used for synthesizing the prediction image for Bframes. This means that using a P+ frame (which has a positive value forthe expectation of the rounding error) and a P− frame (which has anegative value for the expectation of the rounding error) inbidirectional prediction for a B frame is effective in canceling out theeffects of rounding errors. Just as related above, the rounding processin the B frame will not be a cause of error accumulation. Accordingly,no problem will occur even if the same rounding method is applied to allthe B frames. For instance, no serious degradation of decoded images iscaused even if motion compensation using positive rounding is performedfor all of the B frames 502, 504, 506, and 508 in FIG. 5. Preferablyonly one type of rounding is performed for a B frame, in order tosimplify the B frame decoding process.

[0041] A block matching section 1600 of an image encoder according tothe above described motion compensation method utilizing multiplerounding methods is shown in FIG. 16. Numbers identical to those inother drawings indicate the same part. By substituting the blockmatching section 116 of FIG. 1 with 1600, multiple rounding methods canbe used. Motion estimation processing between the input image 101 andthe decoded image of the previous frame is performed in a motionestimator 1601. As a result, motion information 120 is output. Thismotion information is utilized in the synthesis of the prediction imagein a prediction image synthesizer 1603. A rounding method determinationdevice 1602 determines whether to use positive rounding or negativerounding as the rounding method for the frame currently being encoded.Information 1604 relating to the rounding method that was determined isinput to the prediction image synthesizer 1603. In this prediction imagesynthesizer 1603, a prediction image 117 is synthesized and output basedon the rounding method determined by means of information 1604. In theblock matching section 116 in FIG. 1, there are no items equivalent to1602, 1604 of FIG. 16, and the prediction image is synthesized only bypositive rounding. Also, the rounding method 1605 determined at theblock matching section can be output, and this information can then bemultiplexed into the bit stream and be transmitted.

[0042] A prediction image synthesizer 1700 of an image decoder which candecode bit streams generated by a coding method using multiple roundingmethods is shown in FIG. 17. Numbers identical to those in otherdrawings indicate the same part. By substituting the prediction imagesynthesizer 211 of FIG. 2 by 1700, multiple rounding methods can beused. In the rounding method determination device 1701, the roundingmethod appropriate for prediction image synthesis in the decodingprocess is determined. In order to carry out decoding correctly, therounding method selected here must be the same as the rounding methodthat was selected for encoding. For instance the following rule can beshared between the encoder and decoder: When the current frame is a Pframe and the number of P frames (including the current frame) countedfrom the most recent I frame is odd, then the current frame is a P+frame. When this number is even, then the current frame is a P− frame.If the rounding method determination device on the encoding side (Forinstance, 1602 in FIG. 16) and the rounding method determination device1701 conform to this common rule, then the images can correctly bedecoded. The prediction image is synthesized in the prediction imagesynthesizer 1703 using motion information 202, decoding image 210 of theprior frame, and information 1702 related to the rounding methoddetermined as just described. This prediction image 212 is output andthen used for the synthesis of the decoded image. As an alternative tothe above mentioned case, a case where the information related to therounding method is multiplexed in the transmitted bit stream can also beconsidered (such bit stream can be generated at the encoder byoutputting the information 1605 related to the rounding method from theblock matching section depicted in FIG. 16). In such case, the roundingmethod determiner device 1701 is not used, and information 1704 relatedto the rounding method extracted from the encoded bit stream is used atthe prediction image synthesizer 1703.

[0043] Besides the image encoder and the image decoder utilizing thecustom circuits and custom chips of the conventional art as shown inFIG. 1 and FIG. 2, this invention can also be applied to software imageencoders and software image decoders utilizing general-purposeprocessors. A software image encoder 600 and a software image decoder700 are shown in FIG. 6 and FIG. 7. In the software image encoder 600,an input image 601 is first stored in the input frame memory 602 and thegeneral-purpose processor 603 loads information from here and performsencoding. The program for driving this general-purpose processor isloaded from a storage device 608 which can be a hard disk, floppy disk,etc. and stored in a program memory 604. This general-purpose processoralso uses a process memory 605 to perform the encoding. The encodinginformation output by the general-purpose processor is temporarilystored in the output buffer 606 and then output as an encoded bit stream607.

[0044] A flowchart for the encoding software (recording medium readableby computer) is shown in FIG. 8. The process starts in 801, and thevalue 0 is assigned to variable N in 802. Next, in 803 and 804, thevalue 0 is assigned to N when the value for N is 100. N is a counter forthe number of frames. 1 is added for each one frame whose processing iscomplete, and values from 0 to 99 are allowed when performing coding.When the value for N is 0, the current frame is an I frame. When N is anodd number, the current frame is a P+ frame, and when an even numberother than 0, the current frame is a P− frame. When the upper limit forthe value of N is 99, it means that one I frame is coded after 99 Pframes (P+ frames or P− frames) are coded. By always inserting one Iframe in a certain number of coded frames, the following benefits can beobtained: (a) Error accumulation due to a mismatch between encoder anddecoder processing can be prevented (for instance, a mismatch in thecomputation of DCT); and (b) The processing load for acquiring thereproduced image of the target frame from the coded data (random access)is reduced. The optimal N value varies when the encoder performance orthe environment where the encoder is used are changed. It does not mean,therefore, that the value of N must always be 100. The process fordetermining the rounding method and coding mode for each frame isperformed in 805 and the flowchart with details of this operation isshown in FIG. 9. First of all, whether N is a 0 or not is checked in901. If N is 0, then ‘I’ is output as distinction information of theprediction mode, to the output buffer in 902. This means that the imageto be coded is will be coded as an I frame. Here, “output to the outputbuffer” means that after being stored in the output buffer, theinformation is output to an external device as a portion of the codedbit stream. When N is not 0, then whether N is an odd or even number isidentified in 904. When N is an odd number, ‘+’ is output to the outputbuffer as the distinction information for the rounding method in 905,and the image to be coded will be coded as a P+ frame. On the otherhand, when N is an even number, ‘−’ is output to the output buffer asthe distinction information for the rounding method in 906, and theimage to be coded will be coded as a P− frame. The process again returnsto FIG. 8, where after determining the coding mode in 805, the inputimage is stored in the frame memory A in 806. The frame memory Areferred to here signifies a portion of the memory zone (for instance,the memory zone maintained in the memory of 605 in FIG. 6) of thesoftware encoder. In 807, it is checked whether the frame currentlybeing coded is an I frame. When not identified as an I frame, motionestimation and motion compensation is performed in 808. The flowchart inFIG. 10 shows details of this process performed in 808. First of all, in1001, motion estimation is performed between the images stored in framememories A and B (just as written in the final part of this paragraph,the decoded image of the prior frame is stored in frame memory B). Themotion vector for each block is found, and this motion vector is sent tothe output buffer. Next, in 1002, whether or not the current frame is aP+ frame is checked. When the current frame is a P+ frame, theprediction image is synthesized in 1003 utilizing positive rounding andthis prediction image is stored in frame memory C. On the other hand,when the current frame is a P− frame, the prediction image issynthesized in 1004 utilizing negative rounding and this predictionimage is stored in the frame memory C. Next, in 1005, the differentialimage between frame memories A and C is found and stored in frame memoryA. Here, the process again returns to FIG. 8. Prior to starting theprocessing in 809, the input image is stored in frame memory A when thecurrent frame is an I frame, and the differential image between theinput image and the prediction image is stored in frame memory A whenthe current frame is a P frame (P+ or P− frame). In 809, DCT is appliedto the image stored in frame memory A, and the DCT coefficientscalculated here are sent to the output buffer after being quantized. In810, inverse quantization is performed to the quantized DCT coefficientsand inverse DCT is applied. The image obtained by applying inverse DCTis stored in frame memory B. Next in 811, it is checked again whetherthe current frame is an I frame. When the current frame is not an Iframe, the images stored in frame memory B and C are added and theresult is stored in frame memory B. The coding process of a frame endshere, and the image stored in frame memory B before going into 813 isthe reconstructed image of this frame (this image is identical with theone obtained at the decoding side). In 813, it is checked whether theframe whose coding has just finished is the final frame in the sequence.If this is true, the coding process ends. If this frame is not the finalframe, 1 is added to N in 814, and the process again returns to 803 andthe coding process for the next frame starts.

[0045] A software decoder 700 is shown in FIG. 7. After the coded bitstream 701 is temporarily stored in the input buffer 702, this bitstream is then loaded into the general-purpose processor 703. Theprogram for driving this general-purpose processor is loaded from astorage device 708 which can be a hard disk, floppy disk, etc. andstored in a program memory 704. This general-purpose processor also usesa process memory 605 to perform the decoding. The decoded image obtainedby the decoding process is temporarily stored in the output frame memory706 and then sent out as the output image 707.

[0046] A flowchart of the decoding software for the software decoder 700shown in FIG. 7 is shown in FIG. 11. The process starts in 1101, and itis checked in 1102 whether input information is present. If there is noinput information, the decoding process ends in 1103. When inputinformation is present, distinction information of the prediction modeis input in 1104. The word “input” used here means that the informationstored in the input buffer (for instance 702 of FIG. 7) is loaded by thegeneral-purpose processor. In 1105, it is checked whether the encodingmode distinction information is “I”. When not “I”, the distinctioninformation for the rounding method is input and synthesis of theinterframe prediction image is performed in 1107. A flowchart showingdetails of the operation in 1107 is shown in FIG. 12. In 1201, a motionvector is input for each block. Then, in 1202, it is checked whether thedistinction information for the rounding method loaded in 1106 is a “+”.When this information is “+”, the frame currently being decoded is aP+frame. In this case, the prediction image is synthesized usingpositive rounding in 1203, and the prediction image is stored in framememory D. Here, frame memory D signifies a portion of the memory zone ofthe software decoder (for instance, this memory zone is obtained in theprocessing memory 705 in FIG. 7). When the distinction information ofthe rounding method is not “+”, the current frame being decoded is a P−frame. The prediction image is synthesized using negative rounding in1204 and this prediction image is stored in frame memory D. At thispoint, if a P+ frame is decoded as a P− frame due to some type of error,or conversely if a P− frame is decoded as a P+ frame, the correctprediction image is not synthesized in the decoder and the quality ofthe decoded image deteriorates. After synthesizing the prediction image,the operation returns to FIG. 11 and the quantized DCT coefficients isin put in 1108. Inverse quantization and inverse DCT is then applied tothese coefficients and the resulting image is stored in frame memory E.In 1109, it is checked again whether the frame currently being decodedis an I frame. If the current frame is not an I frame, images stored inframe memory D and E are added in 1110 and the resulting sum image isstored in frame memory E. The image stored in frame memory E beforestarting the process in 1111 is the reconstructed image. This imagestored in frame memory E is output to the output frame memory (forinstance, 706 in FIG. 7) in 1111, and then output from the decoder asthe reconstructed image. The decoding process for a frame is completedhere and the process for the next frame starts by returning to 1102.

[0047] When a software based on the flowchart shown in FIGS. 8-12 is runin the software image encoders or decoders, the same effect as whencustom circuits and custom chips are utilized are obtained.

[0048] A storage media (recording media) with the bit stream generatedby the software encoder 601 of FIG. 6 being recorded is shown in FIG.13. It is assumed that the algorithms shown in the flowcharts of FIGS.8-10 is used in the software encoder. Digital information is recordedconcentrically on a recording disk 1301 capable of recording digitalinformation (for instance magnetic disks, optical disk, etc.). A portion1302 of the information recorded on this digital disk includes:prediction mode distinction information 1303, 1305, 1308, 1311, and1314; rounding method distinction information 1306, 1309, 1312, and1315; and motion vector and DCT coefficient information 1304, 1307,1310, 1313, and 1316. Information representing ‘I’ is recorded in 1303,‘P’ is recorded in 1305, 1308, 1311, and 1314, ‘+’ is recorded in 1306,and 1312, and ‘−’ is recorded in 1309, and 1315. In this case, ‘I’ and‘+’ can be represented by a single bit of 0, and ‘P’ and ‘−’ can berepresented by a single bit of 1. Using this representation, the decodercan correctly interpret the recorded information and the correctreconstructed image is synthesized. By storing a coded bit stream in astorage media using the method described above, the accumulation ofrounding errors is prevented when the bit stream is read and decoded.

[0049] A storage media with the bit stream of the coded data of theimage sequence shown in FIG. 5 being recorded is shown in FIG. 15. Therecorded bit stream includes information related to P+, P−, and Bframes. In the same way as in 1301 of FIG. 13, digital information isrecorded concentrically on a record disk 1501 capable for recordingdigital information(for instance, magnetic disks, optical disks, etc.).A portion 1502 of the digital information recorded on this digital diskincludes: prediction mode distinction information 1503, 1505, 1508,1510, and 1513; rounding method distinction information 1506, and 1512;and motion vector and DCT coefficient information 1504, 1507, 1509,1511, and 1514. Information representing ‘I’ is recorded in 1503, ‘P’ isrecorded in 1505, and 1510, ‘B’ is recorded in 1508, and1513, ‘+’ isrecordedin 1505, and ‘−’ is recorded in 1511. In this case, ‘I’, ‘P’ and‘B’ can be represented respectively by two bit values 00, 01, and 10,and ‘+’ and ‘−’ can be represented respectively by one bit values 0and 1. Using this representation, the decoder can correctly interpretthe recorded information and the correct reconstructed is synthesized.In FIG. 15, information related to frame 501 (I frame) in FIG. 5 is 1503and 1504, information related to 502 (B frame) is 1508 and 1509,information related to frame 503 (P+ frame) is 1505 and 1507,information related to frame 504 (B frame) is 1513 and 1514, andinformation related to frame 505 (P− frame) is 1510 and 1512. Whencoding image sequences are coded using B frames, the transmission orderand display order of frames are usually different. This is because theprevious and subsequent reference images need to be coded before theprediction image for the B frame is synthesized. Consequently, in spiteof the fact that the frame 502 is displayed before frame 503,information related to frame 503 is transmitted before informationrelated to frame 502. As described above, there is no need to usemultiple rounding methods for B frames since motion compensation in Bframes do not cause accumulation of rounding errors. Therefore, as shownin this example, information that specifies rounding methods (e.g. ‘+’and ‘−’) is not transmitted for B frames. Thus for instance, even ifonly positive rounding is applied to B frames, the problem ofaccumulated rounding errors does not occur. By storing coded bit streamscontaining information related to B frames in a storage media in the waydescribed above, the occurrence of accumulated rounding errors can beprevented when this bit stream is read and decoded.

[0050] Specific examples of coders and decoders using the coding methoddescribed in this specification is shown in FIG. 14. The image codingand decoding method can be utilized by installing image coding anddecoding software into a computer 1401. This software is recorded insome kind of storage media (CD-ROM, floppy disk, hard disk, etc.) 1412,loaded into a computer and then used. Additionally, the computer can beused as an image communication terminal by connecting the computer to acommunication lines. It is also possible to install the decoding methoddescribed in this specification into a player device 1403 that reads anddecodes the coded bit stream recorded in a storage media 1402. In thiscase, the reconstructed image signal can be displayed on a televisionmonitor 1404. The device 1403 can be used only for reading the coded bitstream, and in this case, the decoding device can be installed in thetelevision monitor 1404. It is well known that digital data transmissioncan be realized using satellites and terrestrial waves. A decodingdevice can also be installed in a television receiver 1405 capable ofreceiving such digital transmissions. Also, a decoding device can alsobe installed inside a set top box 1409 connected to asatellite/terrestrial wave antenna, or a cable 1408 of a cabletelevision system, so that the reconstructed images can be displayed ona television monitor 1410. In this case, the decoding device can beincorporated in the television monitor rather than in the set top box,as in the case of 1404. The layout of a digital satellite broadcastsystem is shown in 1413, 1414 and 1415. The video information in thecoded bit stream is transmitted from a broadcast station 1413 to acommunication or broadcast satellite 1414. The satellite receives thisinformation, sends it to a home 1415 having equipment for receivingsatellite broadcast programs, and the video information is reconstructedand displayed in this home using devices such as a television receiveror a set top box. Digital image communication using mobile terminals1406 has recently attracted considerable attention, due to the fact thatimage communication at very low bit rates has become possible. Digitalportable terminals can be categorized in the following three types: atransceiver having both an encoder and decoder; a transmitter havingonly an encoder; and a receiver having only a decoder. An encodingdevice can be installed in a video camera recorder 1407. The camera canalso be used just for capturing the video signal and this signal can besupplied to a custom encoder 1411. All of the devices or systems shownin this drawing can be equipped with the coding or/and decoding methoddescribed in this specification. By using this coding or/and decodingmethod in these devices or systems, images of higher quality comparedwith those obtained using conventional technologies can be obtained.

[0051] The following variations are clearly included within the scope ofthis invention.

[0052] (i) A prerequisite of the above described principle was the useof block matching as a motion compensation method. However, thisinvention is further capable of being applied to all image sequencecoding and decoding methods in which motion compensation is performed bytaking a value for the vertical and horizontal components of the pixelmotion vector that is other than an integer multiple of the samplingperiod in the vertical and horizontal directions of the pixel, and thenfinding by interpolation, the intensity value of a position where thesample value is not present. Thus for instance, the global motioncompensation listed in Japanese Patent Application No. Hei 08-060572 andthe warping prediction listed in Japanese Patent Application No. Hei08-249601 are applicable to the method of this invention.

[0053] (ii) The description of the invention only mentioned the casewhere a value integral multiple of {fraction (1/2)} was taken for thehorizontal and vertical components of the motion vector. However, thisinvention is also generally applicable to methods in which integralmultiples of 1/d (d is a positive integer and also an even number) areallowed for the horizontal and vertical components of the motion vector.However, when d becomes large, the divisor for division in bilinearinterpolation (square of d, see Equation 2) also becomes large, so thatin contrast, the probability of results from normal division reaching avalue of 0.5 become low. Accordingly, when performing only positiverounding, the absolute value of the expectation for rounding errorsbecomes small and the bad effects caused by accumulated errors becomeless conspicuous. Also applicable to the method of this invention, is amotion compensation method where for instance, the d value is variable,both positive rounding and negative rounding are used when d is smallerthan a fixed value, and only positive rounding or only negative roundingis used when the value of d is larger than a fixed value.

[0054] (iii) As mentioned in the prior art, when DCT is utilized as anerror coding method, the adverse effects from accumulated roundingerrors are prone to appear when the quantized step size of the DCTcoefficient is large. However a method is also applicable to theinvention, in which, when the quantization step size of DCT coefficientsis larger than a threshold value then both positive rounding andnegative rounding are used. When the quantization step size of the DCTcoefficients is smaller than the threshold value then only positiverounding or only negative rounding is used.

[0055] (iv) In cases where error accumulations occur on the luminanceplane and cases where error accumulations occur on the chrominanceplane, the bad effects on the reconstructed images are generally moreserious in the case of error accumulations on the chrominance plane.This is due to the fact that rather than cases where the image darkensor lightens slightly, cases where overall changes in the image colorhappen are more conspicuous. However, a method is also applicable tothis invention in which both positive rounding and negative rounding areused for the chrominance signal, and only positive rounding or negativerounding is used for the luminance signal.

[0056] As described in the description of related art, ¼ pixel accuracymotion vectors obtained by halving the ½ pixel accuracy motion vectorsare rounded to ½ pixel accuracy in H.263. However by adding certainchanges to this method, the absolute expectation value for roundingerrors can be reduced. In H. 263 that was mentioned in the prior art, avalue which is half the horizontal or vertical components of the motionvector for the luminance plane is expressed as r+s/4 (r is an integer, sis an integer less than 4 and not smaller than 0), and when s is 1 or 3,a rounding operation is performed to obtain a 2. This operation can bechanged as follows: When s is 1, a rounding operation is performed toobtain a 0, and when s is 3 a 1 is be added to r to make s a 0. Byperforming these operations, the number of times that the intensityvalues at positions 406-408 in FIG. 4 is definitely reduced (Probabilitythat horizontal and vertical components of motion vector will be aninteger become high.) so that the absolute expectation value for therounding error becomes small. However, even if the size of the erroroccurring in this method can be limited, the accumulation of errorscannot be completely prevented.

[0057] (v) The invention described in this specification is applicableto a method that obtains the final interframe prediction image byaveraging the prediction images obtained by different motioncompensation methods. For example, in the method described in JapanesePatent Application No. Hei 8-2616, interframe prediction images obtainedby the following two methods are averaged: block matching in which amotion vector is assigned to each 16×16 pixel block; and block matchingin which a motion vector is assigned to each 8×8 pixel blocks. In thismethod, rounding is also performed when calculating the average of thetwo prediction images. When only positive rounding is continuouslyperformed in this averaging operation, a new type of rounding erroraccumulates. This problem can be solved by using multiple roundingmethods for this averaging operation. In this method, negative roundingis performed in the averaging operation when positive rounding isperformed in block matching. Conversely, positive rounding is used forthe averaging when negative rounding is used for block matching. Byusing different rounding methods for averaging and block matching, therounding errors from two different sources is cancelled within the sameframe.

[0058] (vi) When utilizing a method that alternately locates P+ framesand P− frames along the time axis, the encoder or the decoder needs todetermine whether the currently processed P frame is a P+ frame or a P−frame. The following is an example of such identification method: Acounter counts the number of P frames after the most recently coded ordecoded I frame, and the current P frame is a P+ frame when the numberis odd, and a P− frame when the number is even (this method is referredto as an implicit scheme). There is also a method for instance, thatwrites into the header section of the coded image information,information to identify whether the currently coded P frame at theencoder is a P+ frame or a P− frame (this method is referred to as anexplicit scheme). Compared with the implicit method, this method is wellable to withstand transmission errors, since there is no need to countthe number of P frames.

[0059] Additionally, the explicit method has the following advantages:As described in “Description for Related Art”, past encoding standards(such as MPEG-1 or MPEG-2) use only positive rounding for motioncompensation. This means for instance that the motion estimation/motioncompensation devices (for example equivalent to 106 in FIG. 1) forMPEG-1/MPEG-2 on the market are not compatible with coding methods thatuses both P+ frames and P− frames. It is assumed that there is a decoderwhich can decode bit streams generated by a coding method that uses P+frames and P− frames. In this case if the decoder is based on the abovementioned implicit method, then it will be difficult to develop anencoder that generates bit streams that can be correctly decoded by theabove mentioned decoder, using the above mentioned motionestimation/compensation device for MPEG-1/MPEG-2. However, if thedecoder is based on the above mentioned explicit method, this problemcan be solved. An encoder using an MPEG-1/MPEG-2 motionestimation/motion compensation device can continuously send P+ frames,by continuously writing rounding method distinction informationindicating positive rounding into the frame information header. Whenthis is performed, a decoder based on the explicit method can correctlydecode the bit stream generated by this encoder. Of course, it should bemore likely in such case that the accumulation of rounding errorsoccurs, since only P+ frames are present. However, error accumulation isnot a serious problem in cases where the encoder uses only small valuesas the quantization step size for the DCT coefficients (an example forsuch coders is a custom encoder used only for high rate coding). Inaddition to this interoperability between past standards, the explicitmethod further have the following advantages:(a) the equipment cost forhigh rate custom encoders and coders not prone to rounding erroraccumulation due to frequent insertion of I frames can be reduced byinstalling only positive or negative rounding as the pixel valuerounding method for motion compensation; and(b) the above encoders notprone to rounding error accumulation have the advantage in that there isno need to decide whether to code the current frame as a P+ or P− frame,and the processing is simplified.

[0060] (vii) The invention described in this specification is applicableto coding and decoding methods that applies filtering accompanyingrounding to the interframe prediction images. For instance, in theinternational standard H. 261 for image sequence coding, a low-passfilter (called a loop filter) is applied to block signals whose motionvectors are not 0 in interframe prediction images. Also, in H. 263,filters can be used to smooth out discontinuities on block boundaries(blocking artifacts). All of these filters perform weighted averaging topixel intensity values and rounding is then performed on the averagedintensity values. Even for these cases, selective use of positiverounding and negative rounding is effective for preventing erroraccumulation.

[0061] (viii) Besides I P+ P− P+ P− . . . , various methods for mixingP+ frames and P− frames such as I P+ P+ P− P− P+ P+ . . . , or I P+ P−P− P+ P+ . . . are applicable to the method of this invention. Forinstance, using a random number generator that outputs 0 and 1 both at aprobability of 50 percent, the encoder can code a P+ and P− frame whenthe output is 0 and 1, respectively. In any case, the less thedifference in probability that P+ frames and P− frames occur in acertain period of time, the less the rounding error accumulation isprone to occur. Further, when the encoder is allowed to mix P+ framesand P− frames by an arbitrary method, the encoder and decoder mustoperate based on the explicit method and not with the implicit methoddescribed above. Accordingly, the explicit method is superior whenviewed from the perspective of allowing flexibility configuration forthe encoder and decoder.

[0062] (ix) The invention described in this specification does not limitthe pixel value interpolation method to bilinear interpolation.Interpolation methods for intensity values can generally be described bythe following equation:

[0063] [Equation 5] $\begin{matrix}{{R\left( {{x + r},{y + s}} \right)} = {T\left( {\sum\limits_{j = {- \infty}}^{\infty}{\sum\limits_{j = {- \infty}}^{\infty}{{h\left( {{r - j},{s - k}} \right)}{R\left( {{x + j},{y + k}} \right)}}}} \right)}} & (5)\end{matrix}$

[0064] where, r and s are real numbers, h(r, s) is a function forinterpolating the real numbers, and T(z) is a function for rounding thereal number z. The definitions of R (x, y), x, and y are the same as inEquation 4. Motion compensation utilizing positive rounding is performedwhen T (z) is a function representing positive rounding, and motioncompensation utilizing negative rounding is performed when the functionrepresenting negative rounding. This invention is applicable tointerpolation methods that can be described using Equation 5. Forinstance, bilinear interpolation can be described by defining h(r, s) asshown below.

[0065] [Equation 6] $\begin{matrix}\begin{matrix}{{{h\left( {r,s} \right)} = {\left( {1 - {r}} \right)\left( {1 - {s}} \right)}},} & {{0 \leq {r} \leq 1},{0 \leq {s} \leq 1},} \\{0,} & {{otherwise}.}\end{matrix} & (6)\end{matrix}$

[0066] However, if for instance h(r,s) is defined as shown below,

[0067] [Equation 7] $\begin{matrix}\begin{matrix}{{{h\left( {r,s} \right)} = {1 - {r} - {s}}},} & {{0 \leq {{r} + {s}} \leq 1},{{rs} < 0},} \\{\quad {{1 - {r}},}} & {{{r} \geq {s}},{{r} \leq 1},{{rs} \geq 0},} \\{\quad {1 - {s}}} & {{{s} > {r}},{{s} \leq 1},{{rs} > 0},} \\{0,} & {{otherwise}.}\end{matrix} & (7)\end{matrix}$

[0068] then an interpolation method different from bilinearinterpolation is implemented but the invention is still applicable.

[0069] (x) The invention described in this specification does not limitthe coding method for error images to DCT (discrete cosine transform).For instance, wavelet transform (for example, M. Antonioni, et. al,“Image Coding Using Wavelet Transform” IEEE Trans. Image Processing,vol. 1, no.2, April 1992) and Walsh-Hadamard transform (for example, A.N. Netravalli and B. G. Haskell, “Digital Pictures”, Plenum Press, 1998)are also applicable to this invention.

What is claimed is:
 1. A computer-readable medium having stored thereonan image decoding program which, when executed by a computer, performsthe steps of: storing a reference image which is a previously decodedimage; receiving information including motion vector information androunding method information specifying a rounding method used insynthesizing a prediction image; and synthesizing a prediction image byperforming motion compensation using the motion vector information andthe reference image; wherein the step of synthesizing a prediction imageincludes the step of performing either a positive rounding method or anegative rounding method for interpolating intensity values of pixels inperforming the motion compensation according to the rounding methodinformation.
 2. A computer-readable medium according to claim 1 ,wherein the rounding method information specifies either the positiverounding method or the negative rounding method.
 3. A computer-readablemedium according to claim 1 , wherein the step of synthesizing aprediction image enables performance of both the positive roundingmethod and the negative rounding method for interpolating intensityvalues of pixels in performing the motion compensation.